// Author	: damphat@gmail.com
// Created	: 01/12/2008

#pragma once
#include "vn/CommonExceptions.h"

#define FALTAL(condition)\
	if(!(condition))\
	throw ArgumentException(#condition);

#define CHECK_ARG(condition)\
	if(!(condition)) {\
	ArgumentException e(#condition);\
	throw e;\
	}

#define CHECK_ARG_RANGE(var, vmin, vmax)\
	if (!(((var) >= (vmin)) && ((var) <= (vmax)))) {\
	ArgumentOutOfRangeException e(#var);\
	throw e;\
	}

#define CHECK_ARG_NOT_NULL(ptr)\
	if(ptr == NULL) {\
	ArgumentNullException e(#ptr);\
	throw e;\
	}

#define CHECK_ARG_FLAGS(var, flagORflag)

#define CHECK_ARG_BUFFER(buf, len)\
	CHECK_ARG_NOT_NULL(buf);\
	CHECK_ARG(len >= 0);

#define CHECK_STATUS(condition)\
	if(!(condition)) {\
	InvalidOperationException e(#condition);\
	throw e;\
	}
